import { createBrowserRouter } from 'react-router-dom'

import App from '../App'
import Home from '../pages/home/Index'
import Login from '../pages/login/Index'
import Number from '../pages/number/Index'
import Register from '../pages/register/Index'
import Ment from '../pages/ment/Index'
import UserManagement from '../pages/user/Index'
import { lazy } from 'react'
import PrivateRoute from './PrivateRoute';
import FileUpload from '../pages/file/Index';

const Index = lazy(() => import('../pages/index/Index'))
const File = lazy(() => import('../pages/file/Index'))

export const children = [
    {
        path: '/home/index',
        element: <Index></Index>,
        key: 'list'
    },
    {
        path: '/home/user',
        element: <UserManagement></UserManagement>,
        key: 'user'
    },
    {
        path: '/home/number',
        element: <Number></Number>,
        key: 'number'
    },
    {
        path: '/home/file',
        element: <File></File>,
        key: 'file'
    }
]

const router = [
    {
        path: '/',
        element: <App></App>,
        children: [
            {
                element: <PrivateRoute />,
                children: [
                    { index: true, element: <Ment /> },
                    { path: '/home', element: <Home />, children: children },
                    { path: '/number', element: <Number />, title: '数字人' },
                    { path: '/ment', element: <Ment /> },
                    { path: '/file', element: <FileUpload /> },
                ]
            },
            { path: '/login', element: <Login /> },
            { path: '/register', element: <Register /> },
        ]
    }
]
export default createBrowserRouter(router);